/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yutel.wuzi.entities;

import javax.microedition.lcdui.Graphics;

/**
 *
 * @author yuanyajun
 */
public class Mouse {
    private int x;
    private int y;

    public Mouse() {
        this.x = 7;
        this.y = 7;
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public void draw(Graphics g,int dx,int dy,int size) {
        g.setColor(0, 0, 0);
        g.drawRect(x * dx + dx-size, y * dy + dy-size, 2*size, 2*size);
    }

    public void moveLeft() {
       // this.erase();
        if(x==0){
            this.x=14;
        }else {
            this.x--;
        }
    }
    public void moveRight() {
       // this.erase();
        if(x==14){
            this.x=0;
        }else {
            this.x++;
        }
        
    }
    public void moveUp() {
        //this.erase();
        if(y==0){
            this.y=14;
        }else {
            this.y--;
        }
    }
    public void moveDown() {
        //this.erase();
        if(y==14){
            this.y=0;
        }else {
            this.y++;
        }
        
    }
}
